﻿//*** Guidance generated code ***//
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics.Contracts;
using System.Linq;

using ProjectBase.Core;

namespace $safeprojectname$.Db
{
    /// <summary>
    ///     Base for ADO.NET DAO. Exposes the DbCommand for CRUD operations,
    ///     which can be wraped with transaction. On UI use the [Transaction] attribute
    ///     for testing explicitly call Begin and Rollback
    ///     If another IDbCommand than SqlClient is used, change
    ///     1) this property getter:  'protected virtual SqlCommand DbCommand'
    ///     2) ProjectSettingsProvider 'IDbCommand NewDbCommand()'
    /// </summary>
    /// <typeparam name = "T">Templated entity which will be read and written via this Dao</typeparam>
    /// <typeparam name = "TID">the template for the ID type. currently supported are decimal, int, short, long, Guid, string</typeparam>
    /// <typeparam name="TFilter"></typeparam>
    /// <typeparam name="TCommand"></typeparam>
    public abstract class BaseDbDao<T, TID, TFilter, TCommand> : ReadDbDao<T, TID, TFilter, TCommand>, IEntityDao<T, TID, TFilter>
        where T : class, IPersistentObjectWithTypedId<TID>, ISetID<TID>, new()
        where TFilter : class, IFilter<TID>
        where TCommand : class, IDbCommand
    {
        public abstract T Add(T entity);
        public abstract T Update(T entity);
        public abstract void Delete(T entity);
    }
}